package org.net.device.chart;

public class valueview {
	private double maxvalue;
	private double minvalue;
	private double totalvalue;
	private int times;
	private double curvalue;
	private double avervalue;

	
	
	public valueview() {
		super();
		reset();
	}
	
	public void reset() {
		this.maxvalue = 0.0;
		this.minvalue = 0.0;
		this.totalvalue = 0.0;
		this.times =0;
		this.curvalue = 0;
		this.avervalue = 0;
	}
	
	public void setValue(double value) {
		this.totalvalue += value;
		this.times++;
		this.curvalue = value;
		this.avervalue = (this.totalvalue/this.times);
		if (this.minvalue == 0.0 || this.minvalue > value) {
			this.minvalue = value;
		}
		if (this.maxvalue == 0.0 || this.maxvalue < value) {
			this.maxvalue = value;
		}
	}

	public double getAvervalue() {
		return avervalue;
	}

	public double getCurvalue() {
		return curvalue;
	}

	public double getMaxvalue() {
		return maxvalue;
	}

	public double getMinvalue() {
		return minvalue;
	}

	public int getTimes() {
		return times;
	}

	public double getTotalvalue() {
		return totalvalue;
	}
	
	
}
